<?php
/**
 * @return
 * @author 朱乐斌
 * @date
 */

namespace app\api\validate;

use think\Validate;

class NotesValidate extends Validate
{

    // 定义验证规则
    protected $rule = [
        'name' => 'require|max:10',
        'id_card' => 'require|max:18|min:18',
        'phone' => 'require|mobile',
        'sex' => 'require',
        'email' => 'require|email',
        'address' => 'require',
        'expertise' => 'require',
        'content' => 'require',
    ];

    // 定义验证提示
    protected $message = [

        'name.require' => '姓名不能为空',
        'name.max' => '姓名不能超过10个字符',
        'id_card.require' =>  '身份证号不能为空',
        'id_card.max' => '身份证号不能超过18个字符',
        'id_card.min' => '身份证不能少于18个字符',
        'phone.require' => '手机号不能为空',
        'phone.mobile' => '手机号格式不正确',
        'sex.require' => '性别不能为空',
        'email.require' => '邮箱不能为空',
        'email.email' => '邮箱格式不正确',
        'address.require' => '地址不能为空',
        'expertise.require' => '擅长领域不能为空',
        'content.require' => '内容不能为空',
    ];

    // 定义验证场景
    protected $scene = [
        'addNotes' => ['name','id_card','phone','sex','email','address','expertise','content'],
        'editNotes' => ['name','id_card','phone','sex','email','address','expertise','content'],
    ];

}